import { FormInstance } from 'ant-design-vue';
import { provide, InjectionKey, inject } from 'vue';

export const FormInstanceKey: InjectionKey<FormInstance> =
  Symbol('FormInstanceKey');

export const useProvideFormInstance = (formInstance: FormInstance) => {
  provide(FormInstanceKey, formInstance);
};

export const useInjectFormInstance = () => {
  return inject(FormInstanceKey);
};
